# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=googlesub
pkgver=14.a7a3cc7
pkgrel=4
pkgdesc='A python script to find domains by using google dorks.'
groups=('blackarch' 'blackarch-recon')
url='https://github.com/zombiesam/googlesub'
arch=('any')
license=('custom:unknown')
depends=('python2' 'python2-requests' 'python2-beautifulsoup4')
makedepends=('git')
source=("git+https://github.com/zombiesam/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 755 "$pkgname.py" "$pkgdir/usr/share/$pkgname"
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 useragent_list.txt "$pkgdir/usr/share/$pkgname"
  install -Dm 644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  cat >"$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

